class  Myrunnable implements Runnable {
    @Override
    public void run() {
        while (true) {
            System.out.println("Thread1");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
class Mythread extends Thread {
    @Override
    public void run() {
        while (true) {
            System.out.println("Thread2");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}

public class T2_0812_0514 {
    public static void main(String[] args) {
        Thread thread1 = new Thread(new Myrunnable());
        thread1.start();

        Thread thread2 = new Mythread();
        thread2.start();

        Thread thread3 = new Thread() {
            @Override
            public void run() {
                while(true) {
                    System.out.println("thread3");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        };
        thread3.start();


        Thread thread4 = new Thread(new Runnable() {
            @Override
            public void run() {
                while(true) {
                    System.out.println("thread4");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        });
        thread4.start();

        Thread thread5 = new Thread(() -> {
            while(true) {
                System.out.println("thread5");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });
        thread5.start();
    }
}
